#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include "XUdp.h"
#include "led.h"
#include "netrecv.h"
#include <QThread>
#include <QDebug>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    void addLogMess(QString mes, Qt::GlobalColor color);
    //CLed lb_led;
    QThread *thread;
    NetRecv *moveThread;
    char m_recv_data[8*1024];
    char m_send_data[4*1024];
    NET_CMD m_net_cmd;
    int timer_id; //定时器1的唯一标示
    //重写定时器的事件   虚函数 子类重写父类的虚函数
    virtual void timerEvent(QTimerEvent *);

    NET_DATA m_net_data;

    bool m_send_flag;
    QString m_path_filename;

signals:
    void udp_recv();

private slots:
    void on_btn_net_connect_clicked();
    void on_update_status(int num);

//    void on_btn_collect_clicked();

 //   void on_btn_path_liulan_clicked();

    void on_btn_version_clicked();

    void on_btn_AD7134_ENABLE_clicked();

    void on_btn_AD7134_W_clicked();

    void on_btn_AD7134_R_clicked();

    void on_btn_AD7134_CS_clicked();

    void on_btn_ed_AD7134_Reset_clicked();

    void on_btn_AD5755_ENABLE_clicked();

    void on_btn_AD5755_RW_clicked();

    void on_btn_AD5755_VALUE_clicked();

    void on_btn_AD5755_RESET_clicked();

    void on_btn_TMC5130_ENABLE_clicked();

    void on_btn_TMC5130_RW_clicked();

    void on_btn_TMC5130_W_VALUE_clicked();

    void on_btn_TMC5130_MODE_clicked();

    void on_btn_TMC5130_SPEED_clicked();

    void on_btn_TMC5130_ANGLE_clicked();

    void on_btn_TMC5130_MODE_EN_clicked();

    void on_btn_TMC5130_STOP_clicked();

    void on_btn_TMC5130_XUANZHUAN_clicked();

    void on_btn_pwm_clicked();

    void on_btn_EEPROM_EN_clicked();

    void on_btn_EEPROM_RW_clicked();

    void on_btn_EEPROM_VALUE_clicked();

    void on_btn_AD7134_R_2_clicked();

    void on_btn_BISS_EN_clicked();

    void on_btn_BISS_VALUE_clicked();

    void on_btn_SIGNAL_0_clicked();

    void on_btn_SIGNAL_1_clicked();

    void on_btn_SIGNAL_2_clicked();

    void on_btn_SIGNAL_3_clicked();

    void on_btn_EC11_NUM_clicked();

    void on_btn_EC11_KEY_clicked();

    void on_btn_common_set_clicked();

    void on_btn_common_read_clicked();

private:
    Ui::Widget *ui;
    char m_ip[256];
    int m_port;
};
#endif // WIDGET_H


